/**
 * 
 */
package com.gopay.bis.ceb.ebank.impl;

import java.util.Map;

import com.gopay.bis.ceb.ebank.operation.CebB2bCertHelper;
import com.gopay.bis.ceb.ebank.operation.CebB2bQueryHelper;
import com.gopay.common.domain.bank.BaseMessage;
import com.gopay.common.domain.bank.ceb.ebank.CebB2bMessage;
import com.gopay.common.exception.GopayException;
import com.gopay.remote.bank.businesses.BankService;

/**
 * @CebB2bBankServiceImpl.java
 * @author Ryan
 * @2013-12-3 上午9:46:59  www.gopay.com.cn Inc.All rights reserved.
 */
public class CebB2bBankServiceImpl implements BankService {

    private  CebB2bCertHelper cebB2bCertHelper;
    
    private CebB2bQueryHelper cebB2bQueryHelper;
    
    @Override
    public Object sign(BaseMessage msg) throws GopayException {
        return cebB2bCertHelper.sign(msg);
    }

    @Override
    public Object verify(BaseMessage msg) throws GopayException {
        return cebB2bCertHelper.verify(msg);
    }

    @Override
    public Object query(Object obj) throws GopayException {
        CebB2bMessage message = (CebB2bMessage)obj;
        String signMessage = cebB2bCertHelper.sign(message);
        message.setSignMessage(signMessage);
        Map<String,String> param = cebB2bQueryHelper.buildQueryParam(message);
        String queryResult =(String)cebB2bQueryHelper.query(param);
        CebB2bMessage resultMessage = cebB2bQueryHelper.parseMessage(queryResult);
        return resultMessage;
    }
    /**
     * @param cebB2bCertHelper the cebB2bCertHelper to set
     */
    public void setCebB2bCertHelper(CebB2bCertHelper cebB2bCertHelper) {
        this.cebB2bCertHelper = cebB2bCertHelper;
    }

    /**
     * @param cebB2bQueryHelper the cebB2bQueryHelper to set
     */
    public void setCebB2bQueryHelper(CebB2bQueryHelper cebB2bQueryHelper) {
        this.cebB2bQueryHelper = cebB2bQueryHelper;
    }

	@Override
	public Object dayend(Object obj) throws GopayException {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public Object refund(Object obj) throws GopayException {
		// TODO Auto-generated method stub
		return null;
	}

}
